<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>模板设计</title>
	<meta name="decorator" content="default"/>
    <script>
    </script>
</head>
<body>
<br/>

<form:form id="inputForm" modelAttribute="eleTemplet" action="${ctx}/templet/eleTemplet/selectSource" method="post" class="form-horizontal">
    <form:hidden path="id"/>
    <form:hidden id="flag" path="flag"/>
    <sys:message content="${message}"/>
    <c:forEach items="${allSource}" var="sourceItem" varStatus="var">
        <input type="hidden" name="eleTempletSourceList[${var.index}].id" value="${sourceItem.value.selectedId}"/>
        <div class="control-group">
            <label class="control-label">
                <form:checkbox path="eleTempletSourceList[${var.index}].sourceType"
                       value="${sourceItem.key}" checked="${sourceItem.value.hasSelected?'checked':''}" />
                ${sourceItem.key}：
            </label>
            <div class="controls">
                <form:select path="eleTempletSourceList[${var.index}].sourceId" itemValue="${sourceItem.value.selectedSourceId}" class="input-large">
                    <c:forEach items="${sourceItem.value.data}" var="item">
                        <option value="${item.id}" ${sourceItem.value.selectedSourceId == item.id?'selected':''}>${item.name}</option>
                    </c:forEach>
                </form:select>
            </div>
        </div>
    </c:forEach>

    <div class="form-actions">
        <shiro:hasPermission name="templet:eleTemplet:edit">
            <input id="btnSubmit" class="btn btn-primary" type="submit" value="保存并设计模板" onclick="$('#flag').val('0');"/>&nbsp;
        </shiro:hasPermission>
        <shiro:hasPermission name="templet:eleTemplet:edit">
            <input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存" onclick="$('#flag').val('1');"/>&nbsp;
        </shiro:hasPermission>
        <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
    </div>
</form:form>
</body>
</html>